﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;

namespace YouHP.Pages.User
{
    public class GetPassword:BasePage
    {
        string email;
        protected override void ShowPage()
        {
            base.ShowPage();
            HandleCommon();
            
          email = RequestTools.GetFormString("email");
            if (IsPost)
                HandlePost();
            else
                HandleGet();


        }

        private void HandleGet()
        {
            
        }

        private void HandlePost()
        {
            if (UserBLL.Instance.GetBackPassword(email))
            {
                this.AddMsgLine("新的密码已经发送到您的邮箱： " + email);
                this.AddMsgLine("请按邮箱中指示进行操作！");
            }
            else
            {
                this.AddErrLine("不存在的邮箱地址！");
            }
        }

        private void HandleCommon()
        {
            this.AddLocation("找回密码", "/User/GetPassword");

        }
    }
}
